package org.bbelovic.devel.exercises.sequences.impl;

import java.util.ArrayList;
import java.util.List;

import org.bbelovic.devel.exercises.sequences.SequenceGenerator;

public class LinearSequenceGenerator implements SequenceGenerator {

    private final int step;

    public LinearSequenceGenerator(final int step) {
        this.step = step;
    }

    public List<Integer> generateSequence(final int length) {
        final List<Integer> sequence = new ArrayList<Integer>();
        int act = 1;
        for (int i = act; i <= length; i++) {
            sequence.add(act);
            act = act + step;
        }
        return sequence;
    }

    public int getStep() {
        return this.step;
    }
}
